<template>
  <div class="main">
    <breadcrumb/>
    <el-tree :data="rightList" :props="defaultProps" default-expand-all></el-tree>
  </div>
</template>

<script>
import Breadcrumb from './../../components/Breadcrumb'
import { getRights } from '@/api/right/rights'
export default {
  name: 'Rights',
  components: { Breadcrumb },
  data: () => {
    return {
      rightList: [],
      defaultProps: {
        children: 'children',
        label: 'authName'
      }
    }
  },
  created () {
    this.getRights()
  },

  methods: {
    async getRights () {
      const { data: res } = await getRights()
      if (res.meta.status !== 200) return this.$message.error(res.meta.msg)
      this.rightList = res.data
    }
  }
}
</script>
<style lang="less" scoped>
  @import "./index";
</style>
